package com.ourygo.fileselect.adapter;
import android.content.*;
import android.view.*;
import android.widget.*;
import com.ourygo.fileselect.*;
import java.util.*;
import android.view.View.*;
import com.ourygo.fileselect.bean.*;
import com.ourygo.fileselect.util.*;

public class BookMarkAdapter extends BaseAdapter
{
	private List<BookMark> data;
	private Context context;
	private ViewHolder vh;
	
	public BookMarkAdapter(Context context,List<BookMark> data){
			this.data=data;
			this.context=context;
	}
	
	@Override
	public int getCount() {
		// TODO: Implement this method
		return data.size();
	}

	@Override
	public Object getItem(int p1) {
		// TODO: Implement this method
		return data.get(p1);
	}

	@Override
	public long getItemId(int p1) {
		// TODO: Implement this method
		return p1;
	}

	@Override
	public View getView(int position, View p2, ViewGroup p3) {
		if(p2==null){
			vh=new ViewHolder();
			p2=LayoutInflater.from(context).inflate(R.layout.path_select_item,null);
			vh.iv_icon=p2.findViewById(R.id.iv_icon);
			vh.tv_name=p2.findViewById(R.id.tv_name);
			
			p2.setTag(vh);
		}else{
			vh=(BookMarkAdapter.ViewHolder) p2.getTag();
		}
		Utils.setImage(context,vh.iv_icon,data.get(position).getIcon());
		vh.tv_name.setText(data.get(position).getName());
		
		// TODO: Implement this method
		return p2;
	}
	
	class ViewHolder{
		ImageView iv_icon;
		TextView tv_name;
	}
	
}
